package infostroy.bookagolf.components.table;

import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.*;

/**
 * Created by Andrew on 14.02.14.
 */
public class GolfTableCellRenderer extends DefaultTableCellRenderer {
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        ImageIcon icon = (ImageIcon) value;
        JLabel label = (JLabel) super.getTableCellRendererComponent(table, "", isSelected, hasFocus, row, column);
        label.setIcon(icon);
        label.setHorizontalAlignment(JLabel.CENTER);
        return label;
    }
}
